package com.zjh.user.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zjh.common.util.UserContext;
import com.zjh.user.dto.DemoInputDTO;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {
    @PostMapping("hello")
    public String hello(@RequestBody DemoInputDTO inputDTO) throws JsonProcessingException {
        String jsonString = new ObjectMapper().writeValueAsString(inputDTO);
        return jsonString;
    }

    @GetMapping
    public String show(){
        System.out.println("userId:" + UserContext.getUser());
        return "show";
    }
}
